From 20f15f51119cb5a7fe188721eb473ab90b19d7f0 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 28 May 2020 15:10:38 +0200 Subject: [PATCH] reftests: Fix frame inhibiting Actually inhibit snapshotting of frames from reftest_inhibit_snapshot. We were not ignoring the case where inhibit_count > 0, and then disconnected the callback meaning we only ever got the first snapshot. --- testsuite/reftests/reftest-snapshot.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/testsuite/reftests/reftest-snapshot.c b/testsuite/reftests/reftest-snapshot.c index 0e2800ec06..5ea2262fe5 100644 --- a/testsuite/reftests/reftest-snapshot.c +++ b/testsuite/reftests/reftest-snapshot.c @@ -206,14 +206,19 @@ reftest_inhibit_snapshot (void) inhibit_count++; } -G_MODULE_EXPORT void +G_MODULE_EXPORT gboolean reftest_uninhibit_snapshot (void) { g_assert (inhibit_count > 0); inhibit_count--; if (inhibit_count == 0) - g_idle_add (quit_when_idle, loop); + { + g_idle_add (quit_when_idle, loop); + return TRUE; + } + + return FALSE; } static void @@ -225,6 +230,8 @@ draw_paintable (GdkPaintable *paintable, cairo_surface_t *surface; cairo_t *cr; + if (!reftest_uninhibit_snapshot ()) + return; snapshot = gtk_snapshot_new (); gdk_paintable_snapshot (paintable, @@ -248,7 +255,6 @@ draw_paintable (GdkPaintable *paintable, cairo_destroy (cr); gsk_render_node_unref (node); - reftest_uninhibit_snapshot (); g_signal_handlers_disconnect_by_func (paintable, draw_paintable, out_surface); *(cairo_surface_t **) out_surface = surface; -- 2.30.2